1. Field of the Invention
The present invention relates to a bar code reader for reading optical information contained in bar codes.
2. Description of the Prior Art
Bar codes consist of a series of adjacent stripes of various widths. A conventional arrangement for reading bar codes is shown in FIG. 9. An image sensor 30 converts an image of a bar code focused thereon into an information signal as shown in FIG. 3B by photoelectric conversion. Then a waveform shaping unit 32 shapes, e.g., amplifies and binarizes, the output signal of image sensor 30 to produce a binary signal as shown in FIG. 3C.
Then, a counter 33 counts the number of pulses of a clock signal generated by a reference clock 31 corresponding to each stripe of the bar code to determine a time period corresponding to the width of each stripe. The pulse count, and the corresponding levels, are stored in a memory 34.
When the counts for all of the stripes of the bar code have been stored, an arithmetic logic unit (hereinafter abbreviated "ALU") calculates the respective widths of the stripes from the pulse counts and determines information represented by the bar code on the basis of the combinations of the widths of the stripes and the corresponding levels.
Counter 33 employed in an existing bar code reader is designed specially for the bar code reader. A level L is assigned to the initial value of counter 33 and data: "Level: L, Pulse count: a" assigned to the first count is stored in memory 34 regardless of the actual level of the binary signal, changes in the level of the binary signal are detected and a combination of a level and a corresponding pulse count, for example, "Level: L1, Pulse count: a" "Level: , H1, Pulse count: b" and the like, are stored in memory 34 every time a level change is detected. The count is reset automatically and the level is changed automatically.
Counter 33, which is employed in the existing bar code reader, detects the change in the level of the binary signal instead of detecting the level of the analog information signal. In some cases, the levels corresponding to the pulse counts are the opposite of the actual levels of the stripes and spaces of the bar code. However, since the same inverted levels are used to interpret the entire bar code, the information represented by the bar code can be read by using such inverted levels.
However, the prior art bar code reader generates erroneous data if the bar code has a defective stripe A, as shown in FIG. 3A, formed by defective printing. Counter 33 requires a period of time after a level change to stop counting, store the results and reinitialize the counter. Therefore, when reading the defective stripe A shown in FIG. 3A, a level change indicated at X in the binary signal will occur while the number of pulses of the clock signal is counted and the data "Level: H4, Pulse count: c" of the defective portion is stored in the memory 34. Consequently, counter 33 is unable to detect the level change X. Consequently, a region B, the level of which must be HIGH, is recognized wrongly as a LOW region as shown in FIG. 3 D.
Thus, if a bar code has a stripe with a defective portion at one end thereof, such as the defective stripe A as shown in FIG. 3A, the high/low correspondence with the actual bar code on one side of the defect differs from that on the other side of the defect. Therefore, ALU 35 translates the bar code wrongly.